package com.base.boot.demo.controller;

import com.base.boot.demo.service.Neo4jDemoService;
import com.base.boot.demo.neo4j.entity.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/noe4j")
public class Neo4jDemoController {

    @Autowired
    Neo4jDemoService neo4jDemoService;

    @RequestMapping("/add")
    public User addUser(User user) {
        log.info("user:{}", user);
        return neo4jDemoService.add(user);
    }

    @RequestMapping("/get")
    public User getUser(Long id) {
        return neo4jDemoService.get(id);
    }
}
